Skip to content

Handle unsupported /b en <type> entity mappings without stacktraces - #490

Merged
NotMyFault merged 3 commits into
mainfrom
copilot/fix-entity-placement-error
Aug 15, 2026
Merged

Handle unsupported /b en <type> entity mappings without stacktraces#490
NotMyFault merged 3 commits into
mainfrom
copilot/fix-entity-placement-error

Conversation

Copilot AI commented May 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #458

/b en <type> could throw when the selected WorldEdit EntityType cannot be adapted to a Bukkit entity class on the running server version. This change converts that failure path into the existing user-facing “cannot spawn” flow.

  • Entity adaptation hardening (EntityBrush#spawn)

    • Wrap BukkitAdapter.adapt(entityType).getEntityClass() with targeted exception handling (IllegalArgumentException).
    • On adaptation failure, emit voxelsniper.brush.entity.cannot-spawn and return early (no thrown stacktrace).
  • Null entity class handling

    • If adaptation resolves but returns null entity class, emit the same cannot-spawn caption and exit before spawn attempts.
  • Behavioral outcome

    • Unsupported or unmappable entity types now fail gracefully and consistently with existing spawn-failure messaging.
Class<? extends org.bukkit.entity.Entity> entityClass;
try {
    entityClass = BukkitAdapter.adapt(entityType).getEntityClass();
} catch (IllegalArgumentException e) {
    messenger.sendMessage(Caption.of("voxelsniper.brush.entity.cannot-spawn"));
    return;
}
if (entityClass == null) {
    messenger.sendMessage(Caption.of("voxelsniper.brush.entity.cannot-spawn"));
    return;
}

Copilot AI linked an issue May 25, 2026 that may be closed by this pull request
2 tasks
Copilot AI changed the title [WIP] Fix stacktrace on entity placement with /b en Handle unsupported /b en <type> entity mappings without stacktraces May 25, 2026
Copilot AI requested a review from NotMyFault May 25, 2026 10:14
@NotMyFault
NotMyFault marked this pull request as ready for review May 25, 2026 10:20
@NotMyFault
NotMyFault requested a review from a team as a code owner May 25, 2026 10:20
@PierreSchwang

Copy link
Copy Markdown
Member

Does that even address the linked issue?

@NotMyFault

Copy link
Copy Markdown
Member

Does that even address the linked issue?

AI thinks so, but the error is gone and entities are spawning.

@NotMyFault NotMyFault added the Bugfix This PR fixes a bug label Aug 15, 2026
@NotMyFault
NotMyFault merged commit febb8b2 into main Aug 15, 2026
6 checks passed
@NotMyFault
NotMyFault deleted the copilot/fix-entity-placement-error branch August 15, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bugfix This PR fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

/b en <type> fires stacktrace on entity placement

3 participants